﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace foursquare
{
    public partial class LoginView : Form
    {
        public LoginView()
        {
            InitializeComponent();

            //Logging log = new Logging();
            //log.EnableLogging(false, false, false);
            //log.SetLoaderLogging(true);
            //log.SetNetworkLogging(true);
            //log.SetInteropLogging(true);
            //log.WriteLoggingSettings();
        }

        private void btnLogin_Click(object sender, EventArgs e)
        {




            //Login to foursquare
            string message = "";

            bool success = FSOAuth.Login(txtUsername.Text, txtPassword.Text, out message);

            if (success)
            {
                FSLocal.SaveCredentials(FS.OAuthToken, FS.OAuthTokenSecret);

                //Go to foursquare page
                HomeView hv = new HomeView();
                hv.Show();

                Hide();
            }
            else
            {
                MessageBox.Show("Unable to login: " + message);
            }
        }
    }
}